package gridmath;

import pac.SearchDatastructure;

public class NumberOfCombinations extends CaseMatrixBase {

	private SearchDatastructure searcher;
	
	public NumberOfCombinations (SearchDatastructure I) { 
		super(I.windowMaker, I.userParams.getMaxorder());
		searcher = I;
		
		specialTypeOfOperation = MatrixOperations.calculateCombinations;
		specialTypeOfOperand = null;	//expects null matrix
	}
	
	public double doOperation (double operand) {
		switch(currentDimension) {
		case 1:
			return (double) searcher.windowMaker.counter[i];
		case 2: 
			return (double) searcher.windowMaker.counter[i] * (double) searcher.windowMaker.counter[j] ;
		case 3:
			return (double) searcher.windowMaker.counter[i] * (double) searcher.windowMaker.counter[j] * (double) searcher.windowMaker.counter[k] ;
		default:
			return (double) searcher.windowMaker.counter[i]  * (double) searcher.windowMaker.counter[j] * (double) searcher.windowMaker.counter[k] * (double) searcher.windowMaker.counter[m] ;
		}
	}
	
}
